/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.omg.deployment.ArtifactDeploymentDescription;
import org.omg.deployment.DeploymentPackage;
import org.omg.deployment.Property;
import org.omg.deployment.Requirement;
import org.omg.deployment.ResourceDeploymentDescription;
import org.omg.xmi.impl.XMIImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Artifact Deployment Description</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getLocation <em>Location</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getNode <em>Node</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getSource <em>Source</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getExecParameter <em>Exec Parameter</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getDeployRequirement <em>Deploy Requirement</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ArtifactDeploymentDescriptionImpl#getDeployedResource <em>Deployed Resource</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ArtifactDeploymentDescriptionImpl extends XMIImpl implements
		ArtifactDeploymentDescription {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The default value of the '{@link #getNode() <em>Node</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNode()
	 * @generated
	 * @ordered
	 */
	protected static final String NODE_EDEFAULT = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArtifactDeploymentDescriptionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DeploymentPackage.eINSTANCE.getArtifactDeploymentDescription();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_Name(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getArtifactDeploymentDescription_Name(), newName);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getLocation() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_Location());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getNode() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_Node(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNode(String newNode) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getArtifactDeploymentDescription_Node(), newNode);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getSource() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_Source());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Property> getExecParameter() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_ExecParameter());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Requirement> getDeployRequirement() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_DeployRequirement());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ResourceDeploymentDescription> getDeployedResource() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getArtifactDeploymentDescription_DeployedResource());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public String getId() {
		if (id == null && this.eResource() != null
				&& this.eResource() instanceof XMLResource) {
			id = ((XMLResource) this.eResource()).getID(this);
		}
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__EXEC_PARAMETER:
			return ((InternalEList<?>) getExecParameter()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOY_REQUIREMENT:
			return ((InternalEList<?>) getDeployRequirement()).basicRemove(
					otherEnd, msgs);
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOYED_RESOURCE:
			return ((InternalEList<?>) getDeployedResource()).basicRemove(
					otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NAME:
			return getName();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__LOCATION:
			return getLocation();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NODE:
			return getNode();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__SOURCE:
			return getSource();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__EXEC_PARAMETER:
			return getExecParameter();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOY_REQUIREMENT:
			return getDeployRequirement();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOYED_RESOURCE:
			return getDeployedResource();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NAME:
			setName((String) newValue);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__LOCATION:
			getLocation().clear();
			getLocation().addAll((Collection<? extends String>) newValue);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NODE:
			setNode((String) newValue);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__SOURCE:
			getSource().clear();
			getSource().addAll((Collection<? extends String>) newValue);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__EXEC_PARAMETER:
			getExecParameter().clear();
			getExecParameter()
					.addAll((Collection<? extends Property>) newValue);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOY_REQUIREMENT:
			getDeployRequirement().clear();
			getDeployRequirement().addAll(
					(Collection<? extends Requirement>) newValue);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOYED_RESOURCE:
			getDeployedResource().clear();
			getDeployedResource()
					.addAll((Collection<? extends ResourceDeploymentDescription>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NAME:
			setName(NAME_EDEFAULT);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__LOCATION:
			getLocation().clear();
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NODE:
			setNode(NODE_EDEFAULT);
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__SOURCE:
			getSource().clear();
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__EXEC_PARAMETER:
			getExecParameter().clear();
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOY_REQUIREMENT:
			getDeployRequirement().clear();
			return;
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOYED_RESOURCE:
			getDeployedResource().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NAME:
			return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT
					.equals(getName());
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__LOCATION:
			return !getLocation().isEmpty();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__NODE:
			return NODE_EDEFAULT == null ? getNode() != null : !NODE_EDEFAULT
					.equals(getNode());
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__SOURCE:
			return !getSource().isEmpty();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__EXEC_PARAMETER:
			return !getExecParameter().isEmpty();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOY_REQUIREMENT:
			return !getDeployRequirement().isEmpty();
		case DeploymentPackage.ARTIFACT_DEPLOYMENT_DESCRIPTION__DEPLOYED_RESOURCE:
			return !getDeployedResource().isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ArtifactDeploymentDescriptionImpl
